<template>
  <div class="box" v-if="Object.keys(contentInfo).length !== 0">
    <div class="text-fiex">
      <div class="left">用户评价</div>
      <div class="right">
        更多
        <i class="iconfont icon-dayuhao"></i>
      </div>
    </div>
    <div class="content">
      <div class="user">
        <img :src="contentInfo.user.avatar" alt="" />
        <span>{{ contentInfo.user.uname }}</span>
      </div>
      <div class="content-info">
        <p>{{contentInfo.content}}</p>
        <span class="date">{{contentInfo.created | showDate}}</span>
        <span>{{contentInfo.style}}</span>
      </div>
      <div class="img">
        <img v-for="item in contentInfo.images" :src="item" alt="">
      </div>
    </div>
  </div>
</template>

<script>
import {formatDate} from 'common/utils'

export default {
  props: {
    contentInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  filters: {
    showDate(value) {
      const date = new Date(value * 1000)
      return formatDate(date, 'yyyy-MM-dd')
    }
  }
};
</script>

<style scoped>
.box {
  padding: 8px;
  border-bottom: 4px solid #f0f0f0;
  margin-bottom: 5px;
}

.text-fiex {
  display: flex;
  justify-content: space-between;
  height: 40px;
  line-height: 40px;
  border-top: 4px solid #f0f0f0;
  border-bottom: 4px solid #f0f0f0;
  font-size: 14px;
}

.text-fiex .right {
  font-weight: 700;
}

.content {
  margin-top: 8px;
}
.iconfont {
  font-size: 12px;
}

.user {
  font-size: 14px;
  font-weight: 700;
}

.user img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.date {
  margin-right: 10px;
}

.content-info p {
  color: #424242;
}

.img {
  margin-top: 10px;
}

.img img {
  width: 70px;
  height: 70px;
  margin-right: 5px;
}
</style>